$(function() {

	x = $('#example').popover({
		html : true,
		content : '<div id="tree"></div>',
		placement : 'bottom',
		trigger : 'manual',
	});
	$("#example").click(function(){
		$('#example').popover('show');
	});
	$('.popover fade bottom in').focusout(function(){
		$('#example').popover('hide');
	});
	
	
	$('#example')
			.on(
					'shown.bs.popover',
					function() {
						$("#tree")
								.dynatree(
										{
											// checkbox: true,
											selectMode : 3,
											onActivate : function(node) {
												if (!node.data.isFolder) {
													// alert("You activated " +
													// node.data.title);
													$("#click")
															.text(
																	node
																			.getParent()
																			.getParent().data.title
																			+ node
																					.getParent().data.title
																			+ node.data.title);
													$('#example').popover(
															'hide');
												} else {
													$("#example").focusin();
												}
											},
											persist : true,
											children : [ {
												title : "北京",
												isFolder : true,
												children : [ {
													title : "北京市",
													isFolder : true,
													children : [ {
														title : "海淀区"
													}, {
														title : "东城区"
													}, {
														title : "西城区"
													}, {
														title : "朝阳区"
													}, ]
												}, ]
											}, {
												title : "上海",
												isFolder : true,
												children : [ {
													title : "上海市",
													isFolder : true,
													children : [ {
														title : "黄浦区"
													}, {
														title : "徐汇区"
													}, {
														title : "长宁区"
													}, {
														title : "静安区"
													}, ]
												}, ]
											}, ]
										});
					});
	
	 $('#datetimepicker1').datetimepicker();
});